﻿<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
	<xsl:output method="html" indent="yes" encoding="utf-8" />
    <xsl:template match="/">
        <xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE HTML>]]></xsl:text>

<html>
<head>
<xsl:text disable-output-escaping="yes"><![CDATA[<meta charset="utf-8">]]></xsl:text>
<xsl:text disable-output-escaping="yes"><![CDATA[<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">]]></xsl:text>

<title>API Differences Report</title>

<xsl:text disable-output-escaping="yes"><![CDATA[<meta name="description" content="">]]></xsl:text>
<xsl:text disable-output-escaping="yes"><![CDATA[<meta name="viewport" content="width=device-width">]]></xsl:text>

<style type="text/css"><xsl:comment>Styles here </xsl:comment></style>

</head>
<body>
	<xsl:apply-templates select="ReleaseDifference" />
	
	<xsl:text disable-output-escaping="yes"><![CDATA[<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>]]></xsl:text>

	<xsl:comment>Local Javascript here </xsl:comment>
	<xsl:text disable-output-escaping="yes"><![CDATA[<script>
		$(document).ready(function() {

			$('tr:even').addClass('even');
			
			$('a.toggle').click(function() {

				var table = $(this).parent().parent().next();

				var newPrompt = '';

				if (table.is(':hidden')) {
					newPrompt = 'Hide';
				} else {
					newPrompt = 'Show';
				}

				table.slideToggle();				
        $(this).text(newPrompt);
				
				return false;
			});
	
		});

	</script>]]></xsl:text>


</body>
</html>

</xsl:template>

<xsl:template match="ReleaseDifference">
<header>
 	<hgroup>
	  <h1><xsl:value-of select="@Name" /> API Differences Report</h1>
 	</hgroup>
</header>

<section>
<p>This report details changes in the public API between versions <strong><xsl:value-of select="@From" /></strong>
and <strong><xsl:value-of select="@To" /></strong> of <strong><xsl:value-of select="@Name" /></strong>. It shows additions, modifications and removals 
of assemblies between the two versions. The links on this page detail which classes, interfaces and enumerations have 
been added, removed or changed in each assembly.</p>
</section>

<article>
  <header>
    <h2><xsl:value-of select="@Name" /> Summary</h2>
    <p><a href="#" class="toggle">Hide</a></p>
  </header>
  <table summary="Summary of changes between versions">
    <caption>Summary of changes</caption>
    <tbody>
      <tr><td>% Churn</td><td><xsl:value-of select="@PercentChurn" /></td></tr>
      <tr><td>Name</td><td><xsl:value-of select="@Name" /></td></tr>
	    <tr><td>From</td><td><xsl:value-of select="@From" /></td></tr>
	    <tr><td>To</td><td><xsl:value-of select="@To" /></td></tr>
	    <tr><td><a href="#removed">Removed</a></td><td><xsl:value-of select="count(RemovedAssemblies/*)"/></td></tr>
	    <tr><td><a href="#changed">Changed</a></td><td><xsl:value-of select="count(ChangedAssemblies/*)"/></td></tr>
      <tr><td><a href="#added">Added</a></td><td><xsl:value-of select="count(AddedAssemblies/*)"/></td></tr>
    </tbody>
  </table>
</article>

<xsl:apply-templates select="RemovedAssemblies"/>

<xsl:apply-templates select="ChangedAssemblies"/>

<xsl:apply-templates select="AddedAssemblies"/>

	<footer>
		<p>Generated by 
      <a>
			<xsl:attribute name="href"><xsl:value-of select="@ProductLink" /></xsl:attribute>
			<xsl:value-of select="@ProductName" /> version <xsl:value-of select="@ProductVersion" />
      </a>
		</p>
	</footer>

</xsl:template>

<xsl:template match="ChangedAssemblies">

<article>
  <header>
    <h2 id="changed">Changed Assemblies</h2>
    <p><a href="#" class="toggle">Hide</a></p>
  </header>
  <table summary="List of assemblies that have changed between versions">
    <caption>List of changed assemblies</caption>
    <tbody>
    <xsl:for-each select="Assembly">
	    <tr><td>
      <a><xsl:attribute name="href"><xsl:value-of select="@Name" />.html</xsl:attribute>
      <xsl:value-of select="@Name" /></a></td></tr>
    </xsl:for-each>
    </tbody>
  </table>
</article>

</xsl:template>

<xsl:template match="RemovedAssemblies">

<article>
  <header>
  <h2 id="removed">Removed Assemblies</h2>
  <p><a href="#" class="toggle">Hide</a></p>
  </header>
  <table summary="List of assemblies that have been removed from the later version">
    <caption>List of removed assemblies</caption>
    <tbody>
    <xsl:for-each select="Assembly">
	    <tr><td><xsl:value-of select="@Name" /></td></tr>
    </xsl:for-each>
    </tbody>
  </table>
</article>

</xsl:template>

<xsl:template match="AddedAssemblies">

<article>
  <header>
    <h2 id="added">Added Assemblies</h2>
    <p><a href="#" class="toggle">Hide</a></p>
  </header>
  <table summary="List of assemblies that have been added in the later version">
    <caption>List of added assemblies</caption>
    <tbody>
    <xsl:for-each select="Assembly">
	    <tr><td><xsl:value-of select="@Name" /></td></tr>
    </xsl:for-each>
    </tbody>
  </table>
</article>

</xsl:template>

</xsl:stylesheet>
